package com.game.sdk.domain;

import java.io.Serializable;
import java.text.DecimalFormat;

import org.json.JSONException;
import org.json.JSONObject;

import com.alipay.android.phone.mrpc.core.ab;

/***
 * 参数传递 int 默认-1， String 默认"" ，float 默认-1.00;
 * */
public class ParamJson implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public static final int ANDROID = 1;// 这个变量是from的一个具体解释

	private String appid = "";// 假名：a key =appid 游戏id

	private String username = "";// 假名：b key =username 充值玩家账号

	private String imei = "";// 假名：c key =imei 手机或者其他机器的硬件唯一标识

	private String from = "";// 假名： d key =from 访问来源：H5，ANDROID,IOS

	private String agentgame = "";// 假名：e key =agentgame 渠道名字

	private String deviceinfo = "";// 假名：f key =deviceinfo
									// 设备数据,包括手机号码、用户系统版本，以||隔开

	private String userua = "";// 假名：g key =userua 用户使用的移动终端的UA信息

	private String password = "";// 假名：h key =password 用户密码（只用作登录和注册上）

	private String server = "";// 假名：i key =server 开服id

	private String payway = "";// 假名：j key =appid payway

	private String productname = "";// 假名：k key =productname 支付用到的商品名字

	private String productdesc = "";// 假名：l key =productdesc 商品描述

	private String attach = "";// 假名：m key =attach 拓展参数

	private String ptbnum_yxbnum = "";// 假名：n key = ptbnum_yxbnum
										// 游戏币和平台币的数量（后台是num）

	private String amount = "";// 假名：o key =amount 充值金额

	private String role = "";// 假名： p key = role 玩家角色名字

	private String issend = "";// 假名：q key =issend 是否发送1标识发送 0标识不发送 验证码

	private String sendcode = "";// 假名：r key =sendcode 验证码

	private String userphone = "";// 假名：s key =userphone 用户userphoone

	private String paystatus = "";// 假名：t key =paystatus 支付状态（0表示支付成功1标识支付失败）

	private String page = "";// 假名：u key =page 查询页数

	private String userid = "";// 假名：v key =userid 用户id

	private String code = "";// 假名：w key =code 用于非对称

	private String client_id = "";// 假名:x

	private String api_token = "";// 假名：y

	private String user_token = "";// 假名：z

	private String params_key = "";// 假名：az

	private String version = "";// 假名：ab 版本

	private String ipaddrid = "";// 假名：ac ip地址

	private String pay_token = "";// 假名 ai
	
	private String orderid = "";// 假名 ak
	
	private String realAmount = "";// 假名 aj
	

	public String getOrderid() {
		return orderid;
	}

	public void setOrderid(String orderid) {
		this.orderid = orderid;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getImei() {
		return imei;
	}

	public void setImei(String imei) {
		this.imei = imei;
	}

	public String getAgentgame() {
		return agentgame;
	}

	public void setAgentgame(String agentgame) {
		this.agentgame = agentgame;
	}

	public String getDeviceinfo() {
		return deviceinfo;
	}

	public void setDeviceinfo(String deviceinfo) {
		this.deviceinfo = deviceinfo;
	}

	public String getPay_token() {
		return pay_token;
	}

	public void setPay_token(String pay_token) {
		this.pay_token = pay_token;
	}

	public String getUserua() {
		return userua;
	}

	public void setUserua(String userua) {
		this.userua = userua;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getServer() {
		return server;
	}

	public void setServer(String server) {
		this.server = server;
	}

	public String getPayway() {
		return payway;
	}

	public void setPayway(String payway) {
		this.payway = payway;
	}

	public String getProductname() {
		return productname;
	}

	public void setProductname(String productname) {
		this.productname = productname;
	}

	public String getProductdesc() {
		return productdesc;
	}

	public void setProductdesc(String productdesc) {
		this.productdesc = productdesc;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public String getAttach() {
		return attach;
	}

	public void setAttach(String attach) {
		this.attach = attach;
	}

	public String getRole() {
		return role;
	}

	public void setRole(String role) {
		this.role = role;
	}

	public String getIssend() {
		return issend;
	}

	public void setIssend(String issend) {
		this.issend = issend;
	}

	public String getSendcode() {
		return sendcode;
	}

	public void setSendcode(String sendcode) {
		this.sendcode = sendcode;
	}

	public String getUserphone() {
		return userphone;
	}

	public void setUserphone(String userphone) {
		this.userphone = userphone;
	}

	public String getAppid() {
		return appid;
	}

	public void setAppid(String appid) {
		this.appid = appid;
	}

	public String getFrom() {
		return from;
	}

	public void setFrom(String from) {
		this.from = from;
	}

	public String getPtbnum_yxbnum() {
		return ptbnum_yxbnum;
	}

	public void setPtbnum_yxbnum(String ptbnum_yxbnum) {
		this.ptbnum_yxbnum = ptbnum_yxbnum;
	}

	public String getAmount() {
		return amount;
	}

	public void setAmount(String amount) {
		this.amount = amount;
	}

	public String getPaystatus() {
		return paystatus;
	}

	public void setPaystatus(String paystatus) {
		this.paystatus = paystatus;
	}

	public String getPage() {
		return page;
	}

	public void setPage(String page) {
		this.page = page;
	}

	public String getUserid() {
		return userid;
	}

	public void setUserid(String userid) {
		this.userid = userid;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getClient_id() {
		return client_id;
	}

	public void setClient_id(String client_id) {
		this.client_id = client_id;
	}

	public String getApi_token() {
		return api_token;
	}

	public void setApi_token(String api_token) {
		this.api_token = api_token;
	}

	public String getUser_token() {
		return user_token;
	}

	public void setUser_token(String user_token) {
		this.user_token = user_token;
	}

	public String getParams_key() {
		return params_key;
	}

	public void setParams_key(String params_key) {
		this.params_key = params_key;
	}

	public String getIpaddrid() {
		return ipaddrid;
	}

	public void setIpaddrid(String ipaddrid) {
		this.ipaddrid = ipaddrid;
	}

	public JSONObject buildParams() {
		JSONObject json = new JSONObject();
		try {
			json.put("a", appid);
			json.put("b", username);
			json.put("c", imei);
			json.put("d", from);
			json.put("e", agentgame);
			json.put("f", deviceinfo);
			json.put("g", userua);
			json.put("h", password);
			json.put("i", server);
			json.put("j", payway);
			json.put("k", productname);
			json.put("l", productdesc);
			json.put("m", attach);
			json.put("n", ptbnum_yxbnum);
			json.put("o", amount);
			json.put("p", role);
			json.put("q", issend);
			json.put("r", sendcode);
			json.put("s", userphone);
			json.put("t", paystatus);
			json.put("u", page);
			json.put("v", userid);
			json.put("w", code);
			json.put("x", client_id);
			json.put("y", api_token);
			json.put("z", user_token);
			json.put("az", params_key);
			json.put("ab", version);
			json.put("ac", ipaddrid);
			json.put("ai", pay_token);
			json.put("ak", orderid);
			json.put("aj", realAmount);
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return json;
	}

	public String getRealAmount() {
		return realAmount;
	}

	public void setRealAmount(String realAmount) {
		this.realAmount = realAmount;
	}

	public JSONObject buildParamsWithoutSelf() {
		JSONObject json = new JSONObject();
		try {
			json.put("a", appid);
			json.put("b", username);
			json.put("c", imei);
			json.put("d", from);
			json.put("e", agentgame);
			json.put("f", deviceinfo);
			json.put("g", userua);
			json.put("h", password);
			json.put("i", server);
			json.put("j", payway);
			json.put("k", productname);
			json.put("l", productdesc);
			json.put("m", attach);
			json.put("n", ptbnum_yxbnum);
			json.put("o", amount);
			json.put("p", role);
			json.put("q", issend);
			json.put("r", sendcode);
			json.put("s", userphone);
			json.put("t", paystatus);
			json.put("u", page);
			json.put("v", userid);
			json.put("w", code);
			json.put("x", client_id);
			json.put("y", api_token);
			json.put("z", user_token);
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return json;
	}

	public String getParamsString() {

		StringBuilder builder = new StringBuilder();
		builder.append("a=").append(appid).append("&b=").append(username)
				.append("&c=").append(imei);

		builder.append("&d=").append(from).append("&e=").append(agentgame)
				.append("&f=").append(deviceinfo);

		builder.append("&g=").append(userua).append("&h=").append(password)
				.append("&i=").append(server);

		builder.append("&j=").append(payway).append("&k=").append(productname)
				.append("&l=").append(productdesc);

		builder.append("&m=").append(attach).append("&n=")
				.append(ptbnum_yxbnum).append("&o=").append(amount);

		builder.append("&p=").append(role).append("&q=").append(issend)
				.append("&r=").append(sendcode);

		builder.append("&s=").append(userphone).append("&t=").append(paystatus)
				.append("&u=").append(page);

		builder.append("&v=").append(userid).append("&w=").append(code)
				.append("&x=").append(client_id);

		builder.append("&y=").append(api_token).append("&z=")
				.append(user_token).append("&ab=").append(version)
				.append("&ac=").append(ipaddrid);
		return builder.toString();
	}

	public String getAllString() {

		StringBuilder builder = new StringBuilder();
		builder.append("a=").append(appid).append("&b=").append(username)
				.append("&c=").append(imei);

		builder.append("&d=").append(from).append("&e=").append(agentgame)
				.append("&f=").append(deviceinfo);

		builder.append("&g=").append(userua).append("&h=").append(password)
				.append("&i=").append(server);

		builder.append("&j=").append(payway).append("&k=").append(productname)
				.append("&l=").append(productdesc);

		builder.append("&m=").append(attach).append("&n=")
				.append(ptbnum_yxbnum).append("&o=").append(amount);

		builder.append("&p=").append(role).append("&q=").append(issend)
				.append("&r=").append(sendcode);

		builder.append("&s=").append(userphone).append("&t=").append(paystatus)
				.append("&u=").append(page);

		builder.append("&v=").append(userid).append("&w=").append(code)
				.append("&x=").append(client_id);

		builder.append("&y=").append(api_token).append("&z=")
				.append(user_token).append("&ab=").append(version)
				.append("&ac=").append(ipaddrid).append("&ai=")
				.append(ipaddrid);
		return builder.toString();
	}
}
